package com.leyou.user.controller;

import com.leyou.common.pojo.R;
import com.leyou.mall.data.entity.Result;
import com.leyou.user.entity.User;
import com.leyou.user.entity.vo.userVo;
import com.leyou.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 车矣捕
 * @version 1.0
 * @description: 描述
 * @date 2022/7/7 19:14
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @PostMapping("/userList")
    public Result userList(userVo user){
        System.err.println("-----"+user.toString());
        return Result.success(userService.userList(user));
    }


    @PostMapping("/updateUserStatus")
    public Result updateUserStatus(userVo user){
        System.err.println("-----"+user.toString());
        return Result.success(userService.updateUserStatus(user));
    }

    @RequestMapping(value = "/userOneById",method = RequestMethod.POST)
    public R userOneById(@RequestParam("id")Integer userId){
        User user = userService.userOneById(userId);
        return R.ok().data("one",user);
    }


}
